package krypto.exercise;

import java.math.BigInteger;

public class W4e2 {

	public static void main(String[] args) {

		BigInteger m,c,e,d,n;
		
		m = BigInteger.valueOf(123);
		e = BigInteger.valueOf(7);
		d = BigInteger.valueOf(103);
		n = BigInteger.valueOf(209);
		
		System.out.println("Plaintext (input)= " + m);

		c = m.modPow(e,n);
		System.out.println("Ciphertext= " + c);

		System.out.println("Plaintext (ciphertext decrypted)= " + c.modPow(d,n));
		
		
		m = BigInteger.valueOf(2);
		e = BigInteger.valueOf(3);
		d = BigInteger.valueOf(107);
		n = BigInteger.valueOf(187);
		
		c = m.modPow(e,n);
		System.out.println("2^3 mod n = ciphertext y = " + c);

		System.out.println("y^d mod n = " + c.modPow(d,n));
	}
}
		
		
		
		//7,3,33
		
//		m = BigInteger.valueOf(18);
//		e = BigInteger.valueOf(7);
//		d = BigInteger.valueOf(103);
//		n = BigInteger.valueOf(209);
//		
//
//		c = m.modPow(e,n);
//		System.out.println("Ciphertext= " + c);
//
//		System.out.println("Plaintext= " + c.modPow(d,n));
		
		
